/*
 * ServerStartingGameStateController.h
 *
 *  Created on: Dec 27, 2011
 *      Author: rudi
 */

#ifndef SERVERSTARTINGGAMESTATECONTROLLER_H_
#define SERVERSTARTINGGAMESTATECONTROLLER_H_
#include <wx/wx.h>
#include "IGameStateController.h"
#include "StaticDrawController.h"

/**
 * This class handles the procedure of the server starting
 *
 * Server starting includes the starting of the server socket and accepting incoming connections
 * @see IGameStateController
 * @author Rudolf Heszele heszele@gmail.com
 * @version 1.0
 * @since 2012-03-08
 */
class ServerStartingGameStateController: public IGameStateController
{
	public:
		/**
		 * The only constructor takes the name of the level to host
		 *
		 * @param level The name of the level to host
		 */
		ServerStartingGameStateController(const wxString& level);
		virtual ~ServerStartingGameStateController();

		// Methods inherited from Controller

		/**
		 * @see IController::handleMouseDown
		 */
		virtual void handleMouseDown(const wxPoint&);
		/**
		 * @see IController::handleMouseUp
		 */
		virtual void handleMouseUp(const wxPoint&);
		/**
		 * @see IController::handleMouseMotion
		 */
		virtual bool handleMouseMotion(const wxPoint&);
		/**
		 * @see IController::getBitmapToPaint
		 */
		virtual const wxBitmap& getBitmapToPaint() const;
		/**
		 * @see IController::getBitmapToDraw
		 */
		virtual wxBitmap& getBitmapToDraw();

		// Methods inherited from GameStateController

		/**
		 * @see IGameStateContrller::handleSocketConnection
		 */
		virtual void handleSocketConnection(wxSocketEvent&);
		/**
		 * @see IGameStateContrller::handleSocketConnection
		 */
		virtual void handleSocketLost(wxSocketEvent&);
		/**
		 * @see IGameStateContrller::handleSocketConnection
		 */
		virtual void handleSocketInput(wxSocketEvent& socketEvent);
		/**
		 * @see IGameStateContrller::handleSocketConnection
		 */
		virtual void handleSocketOutput(wxSocketEvent&);

		// Own methods

		/**
		 * This method sends the configuration to the client side
		 */
		void handleConfigurationNegotioation();

	private:
		StaticDrawController mStaticDrawController;
		/**
		 * True if the the state was entered because of level changing
		 */
		bool mIsNewLevel;
};

#endif /* SERVERSTARTINGGAMESTATECONTROLLER_H_ */
